Skip to content

Wait for each warmup forward before the next one rewrites the static inputs - #50353

Open
qgallouedec wants to merge 6 commits into
mainfrom
cb-warmup-sync
Open

qgallouedec wants to merge 6 commits into
mainfrom
cb-warmup-sync

Conversation

@qgallouedec

@qgallouedec qgallouedec commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

🤗 Transformers CI

What does this PR do?

run_one_warmup prepares the next warmup size while the previous warmup forward can still be running on the compute stream, so that forward's kernels read static inputs being rewritten. The KV paths were short enough never to show it; a model whose first layer reads cu_seq_lens and whose forward is long enough loses the race: Qwen3.5-0.8B with the linear attention layers of #50350 failed every warmup with an illegal memory access, while the tiny test model never did. The fix waits for the compute stream after each warmup forward.

Split out of #50350, which depends on it.

…inputs

run_one_warmup prepared the next warmup size while the previous forward
could still be running on the compute stream, so its kernels read inputs
being rewritten. The KV paths were short enough to never show it; a model
whose first layer reads cu_seq_lens, and whose forward is long enough,
loses the race (Qwen3.5-0.8B with linear attention layers failed every
warmup with an illegal address, the tiny test model never did).
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@qgallouedec
qgallouedec requested a review from remi-or November 10, 2026 11:22

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants